package bite;

/**
 * Creared with IntelliJ IDEA.
 * Description:【倒置字符串】将一句话的单词进行倒置，标点不倒置。比如 I like beijing. 经过函数后变为：beijing. like I
 * User:yxd
 * Date:2022-03-23
 * Time:16:53
 */
import java.util.Scanner;
public class Day2_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.nextLine();
//先将每个单词包括标点都倒置,然后再把整体进行倒置
        char[] ch = s.toCharArray();
        int i = 0;
        while(i < ch.length){
            while(i < ch.length && ch[i] == ' '){
                i ++;
            }
            int j = i;
            while(i < ch.length && ch[i] != ' '){
                i ++;
            }
            reserve(ch,j,i - 1);
        }
        StringBuilder sb = new StringBuilder();
        for (char c: ch) {
            sb.append(c);
        }
        sb.reverse();
        System.out.println(sb.toString());
    }
    public static void reserve(char[] ch,int start,int end){
        while(start < end){
            char tmp = ch[start];
            ch[start] = ch[end];
            ch[end] = tmp;
            start ++;
            end --;
        }
    }
}